package com.data.center.service.mongo;
import com.data.center.entity.mongo.MongoExpert;
import com.data.center.mapper.mongo.MongoExpertRepository ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class MongoExpertService {
    @Autowired
    private MongoExpertRepository expertRepository;

    public List<MongoExpert> getAllExperts() {
        return expertRepository.findAll();
    }

    public Optional<MongoExpert> getExpertById(String expertId) {
        return expertRepository.findByExpertId(expertId);
    }

    public MongoExpert saveExpert(MongoExpert expert) {
        return expertRepository.save(expert);
    }

    public void deleteExpert(String expertId) {
        expertRepository.findByExpertId(expertId);
    }
}
